package com.sun.showcase.pojo;

public class Result<T> {
	/**
	 * 
	 */
	private boolean success = false;// 是否成功
	private String msg = "";// 提示信息
	private T data = null;// 其他信息
	private String code = "0";

	public static <T> Result<T> failed(String msg) {
		return restResult(null, "1", msg);
	}
	public static <T> Result<T> success(String msg) {
		return restResult(null, "0", msg);
	}
	private static <T> Result<T> restResult(T data, String code, String msg) {
		Result<T> apiResult = new Result<>();
		apiResult.setCode(code);
		apiResult.setData(data);
		apiResult.setMsg(msg);
		return apiResult;
	}
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

}
